let Controller = {
  mounted() {
    this.initData();
  },
  activated() {
    this.initData();
    this.requestDetail();
  },
  methods: {
    initData() {
      const param = this.$route.query;
      this.Model.queryData = _.cloneDeep(param);
    },
    getFilterData(val) {
      this.Model.searchFromData = val;
		},
    onTableSelectionChange(val) {
      this.Model.exportTableSelectList = val;
    },
    onTabChange(val) {
      switch (val) {
        case 1:
          break;
        case 2:
          break;
        case 3:
          break;
      }
    },
    requestDetail() {
      const id = this.Model.queryData.id;
      const settlementNumber = this.Model.queryData.settlementNumber;
      if (id) {
        this.$ajax.get(`${api.supplier}/whWarehouseArrival/settlement/detail/list/${id}/${settlementNumber}`)
          .then(response => {
            const data = response.data;
            if (data.status == 200) {
              let temp = data.result
              this.Model.filterOption.items.map(ele => {
                ele.data = temp.warehouse[ele.key] || ''
              })
              this.Model.tableData = temp.detailList
              // const result = data.result;
              // this.Model.detailData = result;
              // this.Model.status = result.status;
              // this.setFilterData();
            }else{
              this.$message.error(data.msg)
            }

          })
          .catch(error => {
            this.$message.error('请求错误');
          });
      }
    },
		setFilterData(result) {
			//arr的第一个元素要换成结算单号，现在没给
			let arr = [result.hahahaha,result.deliveryNo,result.deliveryStatus,result.isAccreditation,result.accreditationStatus,result.poType,result.deliveryCount,result.deliveryTim];
			arr.forEach((item,index)=>{
				this.filterOption.items[index].data = item;
			});
		},
  }
}
export default Controller;
